@extends('admin.layout.base')
@section('styles')
    <style>
        .el-button--info.is-plain{
        	margin-top: 15px;
		    float: left;
		    padding: 8px;
        }
    </style>
@endsection
@section('content')

    <div class="panel-content" id="app" v-cloak>
        <div class="panel-body panel-info">
            <el-form :model="form" ref="form" class="form" label-width="100px">
                <div class="panel-header"> <div class="panel-title">任务信息 </div> </div>
                <div class="panel-main">
                    <el-form-item label="标题：" prop="title">
                        <el-input clearable readonly v-model="info.demand.title"></el-input>
                    </el-form-item>
                    
                    <el-form-item label="任务类别：" prop="pttype_id">
                         <el-input clearable readonly v-model="info.demand.pttype_id"></el-input>
                    </el-form-item>
                    
                    <el-form-item label="任务分类：" prop="cate_id" >
                        <el-input clearable readonly v-model="info.demand.cate_id"></el-input>
                    </el-form-item>
                    
                    <el-form-item label="可得赏金：" prop="price">
                        <el-input clearable readonly v-model="info.get_money"></el-input>
                    </el-form-item>
                   
                    <el-form-item label="开始时间：" prop="start_at">
                        <el-input v-model="info.demand.start_at" readonly ></el-input>
                    </el-form-item>
                    <el-form-item label="截止时间：" prop="end_at">
                        <el-input v-model="info.demand.end_at" readonly ></el-input>
                    </el-form-item>
                   
                    <el-form-item label="需求描述：" prop="content">
                       
                         <el-input type="textarea" rows="3" readonly v-model="info.demand.content"></el-input>
                    </el-form-item>
                    
                </div>
                
                <div class="panel-header"> 
                	<div class="panel-title">提交信息</div> 
                	
                </div>
                <div class="panel-main">
                	<el-form-item label="提交用户：" prop="nickname">
                        <el-input v-model="info.user_info.nickname" readonly ></el-input>
                    </el-form-item>
                    <el-form-item label="用户头像：" prop="avatar">
                    	<img :src="info.user_info.avatar" style="max-width:100px;"/>
                       
                    </el-form-item>
                	<el-form-item label="报名时间：" prop="end_at">
                        <el-input v-model="info.created_at" readonly ></el-input>
                    </el-form-item>
                    <el-form-item label="截止时间：" prop="end_time">
                        <el-input v-model="info.end_time" readonly ></el-input>
                    </el-form-item>
                    
                    <el-form-item label="第一步描述：" prop="step1_user_desc">
                        <el-input type="textarea" rows="3" v-model="info.detail.step1_user_desc" readonly></el-input>
                    </el-form-item>
                     <el-form-item label="上传图：" prop="step1_image">
                        <img :src="info.detail.step1_image" style="max-width:375px;"/>
                    </el-form-item>
                    
                    <el-form-item label="驳回理由：" prop="step1_remark">
                        <el-input type="textarea" rows="3" v-model="form.step1_remark" placeholder="驳回才会生效"></el-input>
                    </el-form-item>
                   
                   <el-form-item label="第二步描述：" prop="step2_user_desc">
                        <el-input type="textarea" rows="3" v-model="info.detail.step2_user_desc" readonly></el-input>
                    </el-form-item>
                     <el-form-item label="上传图：" prop="step2_image">
                        <img :src="info.detail.step2_image" style="max-width:375px;"/>
                    </el-form-item>
                    
                     <el-form-item label="驳回理由：" prop="step2_remark">
                        <el-input type="textarea" rows="3" v-model="form.step2_remark" placeholder="驳回才会生效"></el-input>
                    </el-form-item>
                     <el-form-item label="第三步描述：" prop="step2_user_desc">
                        <el-input type="textarea" rows="3" v-model="info.detail.step3_user_desc" readonly></el-input>
                    </el-form-item>
                     <el-form-item label="上传图：" prop="step3_image">
                        <img :src="info.detail.step3_image" style="max-width:375px;"/>
                    </el-form-item>
                     <el-form-item label="驳回理由：" prop="step3_remark">
                        <el-input type="textarea" rows="3" v-model="form.step3_remark" placeholder="驳回才会生效"></el-input>
                    </el-form-item>
                    
                     <el-form-item label="第四步描述：" prop="step4_user_desc">
                        <el-input type="textarea" rows="3" v-model="info.detail.step4_user_desc" readonly></el-input>
                    </el-form-item>
                     <el-form-item label="上传图：" prop="step4_image">
                        <img :src="info.detail.step4_image" style="max-width:375px;"/>
                    </el-form-item>
                     <el-form-item label="驳回理由：" prop="step4_remark">
                        <el-input type="textarea" rows="3" v-model="form.step4_remark" placeholder="驳回才会生效"></el-input>
                    </el-form-item>
                    
                    <el-form-item label="第五步描述：" prop="step5_user_desc"> 
                        <el-input type="textarea" rows="3" v-model="info.detail.step5_user_desc" readonly></el-input>
                    </el-form-item>
                     
                     <el-form-item label="上传图：" prop="step5_image">
                        <img :src="info.detail.step5_image" style="max-width:375px;"/>
                    </el-form-item>
                    <el-form-item label="驳回理由：" prop="step5_remark">
                        <el-input type="textarea" rows="3" v-model="form.step5_remark" placeholder="驳回才会生效"></el-input>
                    </el-form-item>
                    
                    <el-form-item label="第六步描述：" prop="step6_user_desc">
                        <el-input type="textarea" rows="3" v-model="info.detail.step6_user_desc" readonly></el-input>
                    </el-form-item>
                     
                     <el-form-item label="上传图：" prop="step6_image">
                        <img :src="info.detail.step5_image" style="max-width:375px;"/>
                    </el-form-item>
                    <el-form-item label="驳回理由：" prop="step6_remark">
                        <el-input type="textarea" rows="3" v-model="form.step6_remark" placeholder="驳回才会生效"></el-input>
                    </el-form-item>
                    
                     <el-form-item label="操作：" prop="check_status">
                        <el-radio-group  v-model="form.check_status">
                            <el-radio :label="2" border>驳回</el-radio>
                            <el-radio :label="3" border>通过</el-radio>
                          
                        </el-radio-group>
                    </el-form-item>
                     
                </div>
                <el-form-item style="padding-left: 150px;margin-top: 50px">
                    <el-button v-if="flag==0" type="primary" @click="update()">确 定</el-button>
                    <el-button @click="back()" style="margin-left: 50px">返 回</el-button>
                </el-form-item>
            </el-form>
        </div>
    </div>
@endsection
@section('scripts')
    <script src="{{ asset('neditor/third-party/browser-md5-file.min.js') }}" type="text/javascript"></script>
    <script src="{{ asset('neditor/third-party/jquery-1.10.2.min.js') }}" type="text/javascript"></script>
    <script src="{{ asset('js/moment.min.js') }}" type="text/javascript"></script>
    <script>
        $(function () {
            let app = new Vue({
                el: '#app',
                data: function () {
                    return {
                        date:null,
                        info: {!! $info !!},
                        upload_image: UPLOAD_IMAGE,
                        form: [],                      
                        flag:0
                    }
                },
                created() {
                   
                    let that = this;
                    
                    this.form = this.info.detail;
                    this.form.id = this.info.id;
                    this.form.check_status = this.info.check_status;
                    if(this.form.check_status>1){
						this.flag = 1;
                    }
                  
                },
                
                methods: {
                	
                    //返回
                    back() {
                        window.history.go(-1);
                    },
                    //更新
                    update() {
                        this.form._token = "{{csrf_token()}}";
                        this.$refs['form'].validate((valid) => {
                            
                            if (valid) {
                                let that = this;
                                if(this.form.status == 1){
                                	$.post("{{ route('admin.bid.active') }}", this.form, function (res) {
                                        if (res.code) {
                                            that.$message.error(res.msg);
                                        } else {
                                            that.$message({
                                                type: 'success',
                                                duration: '1000',
                                                message: res.msg,
                                                onClose: () => {
                                                    window.history.go(-1);
                                                }
                                            });
                                        }
                                    }, 'JSON');
                                }else{
                                	$.post("{{ route('admin.bid.lock') }}", this.form, function (res) {
                                        if (res.code) {
                                            that.$message.error(res.msg);
                                        } else {
                                            that.$message({
                                                type: 'success',
                                                duration: '1000',
                                                message: res.msg,
                                                onClose: () => {
                                                    window.history.go(-1);
                                                }
                                            });
                                        }
                                    }, 'JSON');	
                                }
                                
                            }
                        });
                    },
                }
            });
        })
    </script>
@endsection
